package com.seafwg.service.impl;

import com.seafwg.dao.UserDao;
import com.seafwg.service.UserService;

/**
 * @Author seafwg
 * @Date 2022/1/23 7:58 下午
 * @Version 1.0
 * @description xxx
 */

public class UserServiceImpl implements UserService {

    // 1.使用set方法将Dao层的实现注入到service中
    // private UserDao userDao;
    //
    // public void setUserDao(UserDao userDao) {
    //     this.userDao = userDao;
    // }

    // 2.使用构造函数注入，要设置默认无参构造函数
    private UserDao userDao;

    public UserServiceImpl(UserDao userDao) {
        this.userDao = userDao;
    }

    public UserServiceImpl() {
    }

    @Override
    public void save() {
        userDao.save();
        System.out.println("UserServiceImpl run ...");
    }
}
